<html>
<body>
Reports <code>static</code> variables that are lazily initialized in a non-thread-safe manner.
<p>Lazy initialization of <code>static</code> variables should be done with an appropriate synchronization construct
  to prevent different threads from performing conflicting initialization.</p>
<p>When applicable, a quick-fix, which introduces the
<a href="https://en.wikipedia.org/wiki/Initialization_on_demand_holder_idiom">lazy initialization holder class idiom</a>, is suggested.
  This idiom makes use of the fact that the JVM guarantees that a class will not be initialized until it is used.
<p><b>Example:</b></p>
<pre><code>
  class X {
    private static List&lt;String&gt; list;

    public List&lt;String&gt; getList() {
      if (list == null) {
        list = List.of("one", "two", "tree");
      }
      return list;
    }
  }
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
  class X {
    private static final class ListHolder {
      static final List&lt;String&gt; list = List.of("one", "two", "tree");
    }

    public List&lt;String&gt; getList() {
      return ListHolder.list;
    }
  }
</code></pre>
<!-- tooltip end -->
</body>
</html>